﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace CMS_GYM
{
    class clsLichChiTietSaoLuuDAO
    {
        #region Attribute
        /// <summary>
        /// Kết nối SQL Server
        /// </summary>
        private CSQLServer sqlServer = new CSQLServer();
        #endregion

        public DataTable LayBangTheoSanCauId(int SanCauId, DateTime NgaySaoLuu)
        {
            string sql = "sp_GetBangLichChiTietSaoLuuTheoSanCauId";
            string[] ParameterColection = new string[2]{"@SanCauId", "@NgaySaoLuu"};
            Object[] valueofParameter = new Object[2]{SanCauId, NgaySaoLuu};
            DataTable dt = sqlServer.readData(sql, ParameterColection, valueofParameter);
            return dt;
        }

        public DataTable LayBangNgaySaoLuu()
        {
            string sql = "sp_GetInfoLichSaoLuuNgaySaoLuu";
            DataTable dt = sqlServer.readData(sql);
            return dt;
        }

        public int InsertLich(DateTime NgaySaoLuu)
        {
            int i = -1;
            string sql = "sp_InsertLichSaoLuu";
            string[] ParameterColection = new string[1];
            Object[] valueofParameter = new Object[1];
            ParameterColection[0] = "@NgaySaoLuu";
            valueofParameter[0] = NgaySaoLuu;
            i = sqlServer.writeData(sql, ParameterColection, valueofParameter);
            return i;
        }

        public int InsertLichChiTiet(DateTime NgaySaoLuu)
        {
            int i = -1;
            string sql = "sp_InsertLichChiTietSaoLuu";
            string[] ParameterColection = new string[1];
            Object[] valueofParameter = new Object[1];
            ParameterColection[0] = "@NgaySaoLuu";
            valueofParameter[0] = NgaySaoLuu;
            i = sqlServer.writeData(sql, ParameterColection, valueofParameter);
            return i;
        }

        public int DeleteLichChiTiet(DateTime NgaySaoLuu)
        {
            int i = -1;
            string sql = "sp_DeleteLichChiTietSaoLuu";
            string[] ParameterColection = new string[1];
            Object[] valueofParameter = new Object[1];
            ParameterColection[0] = "@NgaySaoLuu";
            valueofParameter[0] = NgaySaoLuu;
            i = sqlServer.writeData(sql, ParameterColection, valueofParameter);
            return i;
        }

        public int DeleteLich(DateTime NgaySaoLuu)
        {
            int i = -1;
            string sql = "sp_DeleteLichSaoLuu";
            string[] ParameterColection = new string[1];
            Object[] valueofParameter = new Object[1];
            ParameterColection[0] = "@NgaySaoLuu";
            valueofParameter[0] = NgaySaoLuu;
            i = sqlServer.writeData(sql, ParameterColection, valueofParameter);
            return i;
        }
    }
}
